<link rel="stylesheet" type="text/css" href="/Static/mobile/css/style.css">
<link rel="stylesheet" type="text/css" href="/Static/mobile/css/SpsBtn.css">
<style>
.nav{
	height:51px;
	background-color:white;
}
</style>
<?php if(!$is_mobile){  ?>
        <style>
html,body{
    height:100%;
    width:50%;
    margin:0 auto;
}
.nav{
    position:fixed;
    width:25%;
}
.morder_nav{
	position:absolute;
}
</style>
        <?php } ?>
<div class="mui-content" style="height:100%;">
	<div class="mui-content-padded">
<!--            <span style="text-align:center;padding:5px;width:100%;display: block;">团队总盒数:<?=$jinhuo_nums?></span>-->
	<div  class="mui-control-content mui-active" >
		<ul class="mui-table-view mui-table-view-chevron" id="service_lists">
		</ul>
	</div>
</div>
</div>

<include file="Common:nav" />
<script src="/Static/mobile/js/jquery-esn-autobrowse/jquery.esn.autobrowse.js"></script>
<script >

$(function() {
    //瀑布流
    var totalPage = '{$totalpage}';
    totalPage = parseInt(totalPage)+1;
    var max = totalPage > 100 ? 100 : totalPage;
    if (totalPage >= 1) {
    	servicelistautobrowse('service_lists', '/mobile/user/daili?dj=<?=get("dj")?>', max);
    }

});


function servicelistautobrowse(dom, url, total) {

    $("#" + dom + "").autobrowse(
            {
                url: function(offset) {
                	console.log(offset);
                    //alert(url.indexOf('?'));//   如果url.indexOf("?")==-1   说明不包含 “?”
                    if (url.indexOf('?') < 1) {
                        return url + '?p=' + offset;
                    }
                    return url + '&p=' + offset;
                },
                template: function(response) {
                    return servicelistcallback(response);
                },
                itemsReturned: function(response) {
                    return response.length;
                },
                max: total,
                offset: 1,
                sensitivity: 100,
                loader: '<p style="text-align:center;padding:20px;">&nbsp;努力加载中...</p>',
                itemsReturned:function(response) {
                    return 1;
                },
                finished: function() {
                   // $(this).append('<p class="loadding mt20">555</p>')
                },
                onError: function() {
                },
                complete: function(response) {
                }
            }
    );
}

function servicelistcallback(response) {
    var markup = '';
    var UPYUN_DOMAIN = "<?php echo C("UPYUN_DOMAIN");?>";
    if (typeof(response) == 'object') {
        for (var i in response) {
            var grade = response[i].grade_name;
            var a = response[i].headimgurl;
            var name = response[i].realname?response[i].realname:response[i].nickname;
            var onerror = "javascript:this.src='__STATIC__/admin/images/error.png';"
            var des = " 等级:"+grade;
            des += "<br>手机:<a href='tel://" + response[i].mobile+ "'>" + response[i].mobile + "</a>";
            markup += '<li class="mui-table-view-cell mui-media">';
            markup += '<div>';               
            markup += '<img onerror='+onerror+' class="mui-media-object onerror mui-pull-left" src="'+a+'" width="42px" height="42px">';
            markup += '<div class="mui-media-body">';
            markup += name;
            //markup += ' 手机：'+response[i].mobile;
            markup += "<p class='mui-ellipsis'>"+des+'</p>';
            markup += '</div>';
            markup += '</div>';
            markup += '</li>';
        }
    }
    return markup;
}

</script>